cc.Class({
    extends: cc.Component,

    properties: {
       
    },

  
    onLoad: function () {
        this.isPassed = false;
        cc.find('Canvas/bg').on('touchstart',this.diciMove.bind(this));

    },
    diciMove:function(){
        this.node.runAction(cc.moveBy(0.1,cc.p(0,140)));

    },

    update:function(dt){
        var tt = cc.find("Canvas").getComponent("Game");
        var master = cc.find("Canvas/bg/master");
        var masterRect = master.getBoundingBoxToWorld();
        var diciRect = this.node.getBoundingBoxToWorld();
        if(cc.rectIntersectsRect(masterRect,diciRect)){
            cc.director.loadScene("over");
        }
        if(! this.isPassed && diciRect.y > masterRect.y){
            this.isPassed = true;
            tt.addScore();
        }

    }

   
});
